package tlcn.app;

import tlcn.data.CopyDB;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;

public class MainActivity extends Activity {

	ImageButton btnListDish,btnShopping,btnSet;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		CopyDB db= new CopyDB();
		db.copy(getAssets());
		init();
	}
	
	private void init(){
		btnListDish= (ImageButton) findViewById(R.id.btnListDish);
		btnListDish.setOnClickListener(onClick);
		btnSet= (ImageButton) findViewById(R.id.btnSet);
		btnSet.setOnClickListener(onClick);
		btnShopping= (ImageButton) findViewById(R.id.btnShopping);
		btnShopping.setOnClickListener(onClick);
		
	}
	OnClickListener onClick= new OnClickListener() {
		
		@Override
		public void onClick(View v) {
			Intent intent=null;
			switch (v.getId()) {
			case R.id.btnListDish:
				intent=new Intent(MainActivity.this, ListDishesActivity.class);
				startActivity(intent);
				break;
			case R.id.btnSet:
				intent=new Intent(MainActivity.this, SetActivity.class);
				startActivity(intent);
				break;
			case R.id.btnShopping:
				intent=new Intent(MainActivity.this, ShoppingActivity.class);
				startActivity(intent);
				break;
			default:
				break;
			}
		}
	};

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}
